3 research outputs found
Logic programming in the context of multiparadigm programming: the Oz experience
Oz is a multiparadigm language that supports logic programming as one of its
major paradigms. A multiparadigm language is designed to support different
programming paradigms (logic, functional, constraint, object-oriented,
sequential, concurrent, etc.) with equal ease. This article has two goals: to
give a tutorial of logic programming in Oz and to show how logic programming
fits naturally into the wider context of multiparadigm programming. Our
experience shows that there are two classes of problems, which we call
algorithmic and search problems, for which logic programming can help formulate
practical solutions. Algorithmic problems have known efficient algorithms.
Search problems do not have known efficient algorithms but can be solved with
search. The Oz support for logic programming targets these two problem classes
specifically, using the concepts needed for each. This is in contrast to the
Prolog approach, which targets both classes with one set of concepts, which
results in less than optimal support for each class. To explain the essential
difference between algorithmic and search programs, we define the Oz execution
model. This model subsumes both concurrent logic programming
(committed-choice-style) and search-based logic programming (Prolog-style).
Instead of Horn clause syntax, Oz has a simple, fully compositional,
higher-order syntax that accommodates the abilities of the language. We
conclude with lessons learned from this work, a brief history of Oz, and many
entry points into the Oz literature.Comment: 48 pages, to appear in the journal "Theory and Practice of Logic
Programming
LogicObjects : A Portable and Extensible Approach for Linguistic Symbiosis between an Object-Oriented and a Logic Programming Language
Logic languages are well suited for declaratively solving computational problems that require knowledge representation and reasoning. Object-oriented programming languages benefit from mature software ecosystems featuring rich libraries and developer tools. Several integration solutions exist that allow a software system to be decomposed into a combination of modules implemented in both a logic and an object-oriented language. Unfortunately, significative amounts of boilerplate code must still be written to accomplish the required interoperability. In addition, such approaches often are not amenable to custom context-dependent reification of objects in the logic world and custom mappings of arbitrary logic terms to objects in the object-oriented world. Furthermore, in the specific case of Prolog-Java integration, existing solutions are often compatible with only a single or a restricted set of Prolog engines and thus suffer from portability issues. To address these problems, we introduce a portable framework, relying on linguistic integration, for transparently and (semi-)automatically enabling communication between routines in these two worlds, as well as a simple mechanism for customising how native artefacts in one language should be reified in the other language. We validate our approach with case studies requiring a seamless integration of declarative programs in Prolog with libraries belonging to the Java ecosyste
Customisable handling of Java references in prolog programs
Integration techniques for combining programs written in distinct language paradigms facilitate the implementation of specialised modules in the best language for their task. In the case of Java-Prolog integration, a known problem is the proper representation of references to Java objects on the Prolog side. To solve it adequately, multiple dimensions should be considered, including reference representation, opacity of the representation, identity preservation, reference life span, and scope of the inter-language conversion policies. This paper presents an approach that addresses all these dimensions, generalising and building on existing representation patterns of foreign references in Prolog, and taking inspiration from similar inter-language representation techniques found in other domains. Our approach maximises portability by making few assumptions about the Prolog engine interacting with Java (e.g., embedded or executed as an external process). We validate our work by extending JPC, an open-source integration library,with features supporting our approach. Our JPC library is currently compatible with three different open source Prolog engines (SWI, YAP and XSB) by means of driver